import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

class Home extends StatefulWidget {
  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  List<String> images = [
    'https://gimg3.baidu.com/rel/src=https%3A%2F%2Fgips3.baidu.com%2Fit%2Fu%3D3784828262%2C2035215714%26fm%3D3028%26app%3D3028%26f%3DPNG%26fmt%3Dauto%26q%3D75%26size%3Df1138_640&refer=http%3A%2F%2Fwww.baidu.com&app=2010&size=w560&n=0&g=0n&q=100&fmt=auto?sec=1698858000&t=d23afedfb8fc3bca9a160eac8e9eda5b',
    'https://gimg3.baidu.com/rel/src=https%3A%2F%2Fgips3.baidu.com%2Fit%2Fu%3D3784828262%2C2035215714%26fm%3D3028%26app%3D3028%26f%3DPNG%26fmt%3Dauto%26q%3D75%26size%3Df1138_640&refer=http%3A%2F%2Fwww.baidu.com&app=2010&size=w560&n=0&g=0n&q=100&fmt=auto?sec=1698858000&t=d23afedfb8fc3bca9a160eac8e9eda5b',
    'https://gimg3.baidu.com/rel/src=https%3A%2F%2Fgips3.baidu.com%2Fit%2Fu%3D3784828262%2C2035215714%26fm%3D3028%26app%3D3028%26f%3DPNG%26fmt%3Dauto%26q%3D75%26size%3Df1138_640&refer=http%3A%2F%2Fwww.baidu.com&app=2010&size=w560&n=0&g=0n&q=100&fmt=auto?sec=1698858000&t=d23afedfb8fc3bca9a160eac8e9eda5b'
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('多威商城'),
        elevation: 0,
      ),
      body: Column(
        children: [
          //轮播图
          Container(
            height: 190,
            child: Swiper(
              itemCount: images.length,
              autoplay: true,
              itemBuilder: (BuildContext context, int index) {
                return Image.network(
                  images[index],
                  fit: BoxFit.fill,
                );
              },
              pagination: SwiperPagination(
                  alignment: Alignment.bottomRight,
                  builder: RectSwiperPaginationBuilder(
                      activeColor: Colors.white,
                      color: Colors.grey,
                      size: Size(20, 10),
                      activeSize: Size(20, 10))),
            ),
          ),
          //
          Container(
            margin: EdgeInsets.only(top: 15),
            child: Image.asset(
              'images/home/classification.png',
              width: 192,
              height: 60,
            ),
          ),
          Container(
            padding: EdgeInsets.only(top: 15, left: 15, right: 15),
            child: GestureDetector(
              onTap: () {
                Navigator.pushNamed(context, 'classification');
              },
              child: Column(
                children: [
                  Image.asset(
                    'images/home/xie.png',
                    height: 100,
                  ),
                  SizedBox(
                    height: 15,
                  ),
                  Image.asset(
                    'images/home/yi.png',
                    height: 100,
                  )
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}
